package com.tnl.app.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tnl.app.dao.EmployerDAO;
import com.tnl.app.dao.PersonDAO;
import com.tnl.app.dao.WxAppUserDAO;
import com.tnl.app.entity.Employer;
import com.tnl.app.entity.Person;
import com.tnl.app.entity.WxAppUser;
import com.tnl.app.service.UserService;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private WxAppUserDAO wxAppUserDAO;
	@Autowired
	private PersonDAO personDAO;
	@Autowired
	private EmployerDAO employerDAO;
	
	
	@Override
	public String getPhone(String openId) {
		WxAppUser wxuser=wxAppUserDAO.getByOpenId(openId);
		String phone=wxuser.getMobile();
		return phone;
	}
	
	@Override
	public Person getPersonId(String phone){
		Person person=personDAO.getByPhone(phone);
		return person;
	}
	
	@Override
	public Employer getEmployerId(Integer employerId){
		Employer employer=employerDAO.getById(employerId);
		return employer;
	}
}
